import cookie from "react-cookie";

export function login(url) {
    const token = cookie.load("token");
    const isFromApp = cookie.load("isFromApp");
    if (!token) {
        if (isFromApp == 0) {
            window.location.href = "/#/mall/login";
        } else {
            try {
                iosLogin();
            } catch (e) {
            }
            try {
                window.lubobo.login();
            } catch (e) {
            }
        }
    } else {
        window.location.href = url;
    }
}